package at.ac.tuwien.dse.health.admin.jdbc

/** Contains convenience methods for JDBC support. */
trait JdbcSupport {
	implicit val jdbcTemplate: JdbcTemplate

	/** Creates a [[at.ac.tuwien.dse.health.admin.jdbc.PreparedStatementHolder]] for the given SQL string. */
	implicit def prepareStatement(sql: String)(implicit jdbcTemplate: JdbcTemplate) = new PreparedStatementHolder(jdbcTemplate, sql)

	/** Executes the given SQL query using the provided [[at.ac.tuwien.dse.health.admin.jdbc.JdbcTemplate]]. */
	implicit def runQuery(sql: String)(implicit jdbcTemplate: JdbcTemplate) = jdbcTemplate.query(prepareStatement(sql))
}

